/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.sicop.principal;
import com.sicop.entidades.Contratista;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
/**
 *
 * @author EVELIN
 */
public class SicopPatpro {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Contratista contratista = new Contratista ();
        
        contratista.setIdcontratista("0000201341909969");
        contratista.setRazonSocial("ConstuctLife SRL");
        contratista.setDireccion("Jr. Ayacucho N° 345");
        contratista.setRuc("0000201341909969");
        contratista.setCodigoSnip("SNIP24092013");
      
    }
       public static void persist(Object object) {
        EntityManagerFactory emf = Persistence.createEntityManagerFactory("sicop-patproPU2");
        EntityManager em = emf.createEntityManager();
        em.getTransaction().begin();
        try {
            em.persist(object);
            em.getTransaction().commit();
        } catch (Exception e) {
            e.printStackTrace();
            em.getTransaction().rollback();

        } finally {
            em.close();
        }
    } 
}
